export default {
  data() {
    return {
      name: this.option.name,
      value: this.option.value,
      error_: false,
      error_message_: ''
    }
  },
  computed: {
    placeholder() {
      return this.option.placeholder
    },
    disabled() {
      return this.option.disabled
    },
    max() {
      return this.option.max || 200
    },
    min() {
      return this.option.min || 0
    },
    msg() {
      return this.option.msg
    },
    required() {
      return this.option.required
    },
    readonly() {
      return this.option.readonly
    },
    clearable() {
      return this.option.clearable
    },
    checker() {
      return this.option.checker
    }
  },
  methods: {
    fieldCheck() {
      const { error_, error_message_ } = this
      this.dispatch_event('field-check', { error: error_, error_message: error_message_ })
    },

    async check() {
      await this.setCheck()
      return !this.error_
    }
  }
}
